﻿using Esint.JudicialAuction.BLL;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using WebJudicialAuction.admin.bases;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using Esint.Common;

namespace WebJudicialAuction.admin.handler
{
    /// <summary>
    /// common 的摘要说明
    /// </summary>
    public class common : BaseHandler, IHttpHandler
    {
        
        Sys_CodeService codeBll = new Sys_CodeService();

        protected override AjaxResult BusinessHandleFunc(string req_type, Dictionary<string, string> dicData)
        {
            AjaxResult ajaxResult = new AjaxResult();

            switch (req_type)
            {
                default:
                    break;
                case "GetCodeListByFlagList":
                    {
                        #region 根据分类代码标识查询代码列表
                        var flagListArr = JArray.Parse(dicData["flagArr"]);
                        
                        var flagList = flagListArr.ToList<string>();

                        var codeList = codeBll.GetCodeListByFlagList(flagList);
                        ajaxResult.flag = AjaxResultFlag.Success;
                        ajaxResult.data = codeList;
                        ajaxResult.msg = AjaxMessage.OperationSuccess;

                        break; 
                        #endregion
                    }

                case "GetCodeList":
                    {
                        var codeList = codeBll.GetCodeListByFlag(dicData["flag"]);
                        ajaxResult.flag = AjaxResultFlag.Success;
                        ajaxResult.data = codeList;
                        ajaxResult.msg = AjaxMessage.OperationSuccess;

                        break;
                    }
            }

            return ajaxResult;
        }
    }
}